package otherWork;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 * Created by lenovo on 2017/1/6.
 */
public class HelloWorld {
    static Connection con = null;

    public static void main(String[] args){

//        con = JDBCUtils.getConnection();

//        getDateStr();

        String str = "jfdsl#jfk#dls";
        int indexOf = str.indexOf("-")==-1?str.length():str.indexOf("-");
        System.out.println(str.indexOf("#"));
        System.out.println("2 = " +str.substring(0,indexOf));
        System.out.println("3 = " +str.substring(indexOf));

        for(int i=0 ; i< 30; i++){
            System.out.println(i);
        }
    }

    public static String getDateStr(){

        String dateStr = "select to_char(sysdate,'yyyymmddhh24miss')||TO_NUMBER(TO_CHAR(SYSTIMESTAMP(3), 'FF')) as da from dual";
        try{
            con.setAutoCommit(false);
            PreparedStatement pre = con.prepareStatement(dateStr);

            ResultSet resultSet = pre.executeQuery();
            resultSet.next();
            dateStr = resultSet.getString(1);
            System.out.println(dateStr);


        }catch (Exception e){
            System.out.println("getSql1 exception");
            e.printStackTrace();


        }
        return dateStr;
    }
}
